Page({

  /**
   * 页面的初始数据
   */
  data: {
    
  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {
    
  },

  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady: function () {
    
  },

  /**
   * 生命周期函数--监听页面显示
   */
  onShow: function () {
    
  },
  generate:function(){
    var that = this
    wx.request({
      url: 'http://api.weixin.qq.com/wxa/getwxacodeunlimit?access_token=NKWG3Aj4XXLCCUfZw1lLdOkT2h4ucqoUg3LmoG69veYOcgQMegMz4fbX7K8DxDnI2uxX1XeLxbyJgCOwewstUy3A6sXL6adcRSjA_g8NELrr-auHlpmBhNPokVPpin9iGCSgAEAOKA',
      method:"POST",
      data:{
        scene:'bbb',
        page: "pages/my/my-center/my-center"
      },
      complete(res){
        wx.downloadFile({
          url: res.data, 
          complate: function (res) {            
            that.setData({
              code: res.tempFilePath
            })
          }
        })
        
        console.log(res)
      }
    })
  },
  navigateTo:function(e){
    var type = e.currentTarget.dataset.type
    switch(type){
      case 'mycard':
        wx.switchTab({
          url: '/pages/mycard/card-list/card-list',
        })
      break;
    }
  }
})